package com.example.util;

import org.apache.commons.beanutils.ConvertUtils;

public class ConvertUtil {
    
    //将object转化成int型   
    public static int intConvert(Object object){   
        String str = object==null?null:object.toString();   
        Object obj = ConvertUtils.convert(str, Integer.class);   
        Integer i= (Integer)obj;   
        return i;   
    }   
    //将任意的Object转换成string   
    public static String stringConvert(Object object){   
        Object obj = ConvertUtils.convert(object);   
        String string = (String) obj;   
        return string;   
    }   
    public static boolean booleanConvert(Object object){   
        String str = object == null?null:object.toString();   
        Object obj = ConvertUtils.convert(str, Boolean.class);   
        boolean b =(Boolean)obj;   
        return b;   
    }   



}
